home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
301-325
/
325
/
dclock
/
dclock-handler.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-14
|
57KB
|
2,003 lines
/* DClock-Handler.c *********************************************************
*
* DClock-Handler -------- Dumb clock main handler routine,
* displays clock data and handles
* DisplayBeep.
*
* Author ---------------- Olaf 'Olsen' Barthel, MXM
* Brabeckstrasse 35
* D-3000 Hannover 71
*
* Federal Republic of Germany
*
* This program truly is in the PUBLIC DOMAIN. Written on a cold
* and damp September evening, hoping the next morning would be
* better.
*
* Compiled using Aztec C 3.6a, CygnusEd Professional 2 & ARexx.
*
****************************************************************************/
#include "DClock.h"
#define SIG_CLICK SIGBREAKF_CTRL_C
#define SIG_CLOSE SIGBREAKF_CTRL_D
#define SIG_TIMER SIGBREAKF_CTRL_E
#define SIG_TOGGL SIGBREAKF_CTRL_F
#define SIG_BENCH (1 << BenchSig)
#define SIG_WINDO (1 << Window -> UserPort -> mp_SigBit)
/* Some global data. */
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Window *Window;
struct RastPort *RPort;
struct DSeg *DSeg;
extern struct ExecBase *SysBase;
ULONG BenchSig;
/* Our dummy RastPort. */
struct BitMap DummyMap;
struct RastPort DummyRPort;
/* Default font for clock text. */
struct TextAttr DefaultFont =
{
(UBYTE *)"topaz.font",
8,
FS_NORMAL,
FPF_ROMFONT
};
/* IntuiText to print clock text. */
struct IntuiText TimeString =
{
0,1,
JAM2,
0,0,
(struct TextAttr *)&DefaultFont,
(UBYTE *)NULL,
(struct IntuiText *)NULL
};
USHORT LeftEdge = 409,TopEdge = 1,Width = 176,Height = 8;
struct NewWindow NewWindow =
{
0,0,
1,1,
0,1,
REFRESHWINDOW,
BORDERLESS | BACKDROP | BACKDROP | SIMPLE_REFRESH,
(struct Gadget *)NULL,
(struct Image *)NULL,
(STRPTR)NULL,
(struct Screen *)NULL,
(struct BitMap *)NULL,
0,0,
0,0,
WBENCHSCREEN
};
/* Some static imagery. */
USHORT MapF[16] =
{
0x0000,0x3FC0,0x3000,0x3FC0,0x3000,0x3000,0x3000,0x0000,
0xFFF0,0xC030,0xCFF0,0xC030,0xCFF0,0xCFF0,0xCFF0,0xFFF0
};
USHORT MapE[16] =
{
0x0000,0x3FC0,0x3000,0x3FC0,0x3000,0x3000,0x3FC0,0x0000,
0xFFF0,0xC030,0xCFF0,0xC030,0xCFF0,0xCFF0,0xC030,0xFFF0
};
struct Image ImageF =
{
164,0,
12,8,2,
(USHORT *)MapF,
0x03,0x00,
(struct Image *)NULL
};
struct Image ImageE =
{
0,0,
12,8,2,
(USHORT *)MapE,
0x03,0x00,
(struct Image *)&ImageF
};
/* Here comes the click data. */
#define LEFT0F 1
#define RIGHT0F 2
#define RIGHT1F 4
#define LEFT1F 8
UBYTE AnyChannel[4] =
{
LEFT0F,
LEFT1F,
RIGHT0F,
RIGHT1F,
};
/* Audio.device control structures. */
struct MsgPort *AudioPort;
struct IOAudio *Audio;
/* Input.device control structures. */
struct MsgPort *InputDevPort;
struct IOStdReq *InputRequestBlock;
/* The interrupt handler control. */
struct Interrupt HandlerStuff;
/* Console.device control structures. */
long ConsoleDevice = NULL;
struct IOStdReq ConStdReq;
struct InputEvent CopyEvent;
/* This noise was borrowed from Mike Oldfield's
* "Taurus 2". Sampled with AudioMaster, converted
* to 'C' sourcecode using a program of mine
* called "SaveSound".
*/
ULONG SoundData[67] =
{
0xFB0F190A,0xDDB9B4F1,0x377F651E,0xC4B4D323,0x3CEC3274,0x5B0AE2DD,
0xF105D8E2,0x1937561E,0x00E7DDDD,0xCE9BD3F6,0x0F2D1EEC,0xF1F1D8BE,
0xAAC4E2FB,0x192D3232,0x05F6DDCE,0xD3F6FB0F,0x234C3C1E,0x0AFBF6DD,
0xC4DDFB0F,0x1E282319,0x0AFBE2C4,0xD3E2F1F1,0xFB1E370A,0xE7F6F6E2,
0xC9C9D8FB,0x0FFBFBFB,0x0A05F1C9,0xC9F6F6E7,0xECFB1914,0xF1D8ECFB,
0xECD8D3DD,0xFB14F1DD,0xECFBF6E2,0xCEC9ECFB,0xE7D8E7FB,0xFBECD3D3,
0xF1F6E2D3,0xE2F600F6,0xE2E2FBFB,0xECE2E7F1,0xFBFBE7EC,0xFBFBF1EC,
0xE7F1FBF1,0xE7ECF6F6,0xF1E7ECFB,0xFBFBECE7,0xE7ECECE7,0xF6FBFBF6,
0xF6F6F6F6,0xF1F6F6F6,0xFBFBFBFB,0xFBFB05FB,0xFBFBFBFB,0xFBFB050A,
0x0505050A,0x0505FBFB,0xFBFBFBFB,0x0A0A0A05,0x05000505,0x05050505,
0x05050A0A,0x0A0A0505,0x05050005,0x05050A0A,0x0505050A,0x05050005,
0x05050505
};
/* Sound run-dump for the ringing alarm clock. Sampled with
* AudioMaster II, taken from the introduction to "Time"
* by Pink Floyd (album: "The Dark Side of the Moon").
*/
ULONG RingData[1831] =
{
0xAFA30D00,0x3FDF95D9,0x153D27CD,0xC1E7EFE9,0x3FF9B5DF,0xD73F1DBF,
0x95B7E12D,0x0DD1E9DB,0xDB4D0BF1,0xE7CF0F37,0x3FE5CFC5,0x17652FF1,
0xA9E7332D,0x00E1BFE9,0xFF150003,0x93D93F37,0x1FD7B5F1,0x3D17FFB9,
0xA9EF1D17,0x1FAFDBDF,0xFF1F15DF,0xB5D71F53,0xF9B5D9DF,0x2925CD03,
0xD7CFF155,0x1FD7BDE1,0x4D4DF7D1,0xBF0BFF0D,0x1FE9E7C7,0x1D1F1FBB,
0xB7093335,0x1FBDD1FF,0x2D3527E9,0xCB1DEF2F,0x09D7B7D9,0x1F371DE1,
0xB50B351D,0xD9E909EF,0x2DF129F9,0xB7CB333B,0xF7CFC1DF,0x39EFDDE9,
0xE1FFFF43,0xF10BCBE7,0x2F27FFDB,0xCFE10D3F,0xD9D1F10D,0x2D071FC1,
0xFFD9E937,0x29CFD1E7,0x252507AB,0xFD0DCB17,0x000BDFD7,0x07352DD9,
0xBB00090D,0xE10FD1E9,0x15DD3700,0xAFC5FF17,0x1DF7C1E1,0x27D539E9,
0xE5F3FF2B,0x0F0DE1DF,0xE9173500,0xE5C9F745,0xE700E5CF,0x05150000,
0x15ABE74B,0x1721CBC1,0x2D1523C7,0xDDD1EF15,0x0F1FB7D7,0xDBFF27D7,
0xC5E1E737,0x37F9ADF1,0xDF353BC1,0xE1EBEF00,0x1DE1BBD7,0xE13D43C9,
0xCFBF2535,0xFFF1C1E7,0xF11D0FF1,0xBFB73541,0x0F039FD3,0x212D2F00,
0xC5D9452F,0x2FF5B705,0xE7FF2D01,0x0FA71D1B,0x1307E90F,0xE90717FD,
0xE7B5E123,0x552700D1,0xBDFFEF00,0x0BDF2507,0x5707BFD5,0xC92B3329,
0xE5D5F1FF,0x1BB9C917,0xFF05D107,0xE1E7CF00,0x45FFBF9D,0xC523F7C7,
0xD1F11BDF,0x23E1E9CD,0xE7390D1D,0xF7C7E105,0x35E1C9F5,0x0D35E51F,
0xC1BFD5F3,0x0F17EFC1,0xEF211DD5,0xA5D10DF7,0x1FD900DB,0xCF173735,
0xEFDFD917,0x11CBD1C1,0xFD4BFF1F,0xE5E7D70D,0xE9130DBF,0xF30F313F,
0xBFC5133D,0x35DDF9C9,0x0DEF0023,0xDDCFEB27,0x2715B3AB,0xFF3F250D,
0xC100B73D,0x1FF1E1FF,0xFF1F5103,0xF3BFBB1F,0x4DE3D1C7,0x173529B1,
0xE1F7EF39,0x0F00C1B7,0xCD1F2703,0xBFD50B3D,0xFFE991BD,0x191D3F00,
0xD1C7EF07,0x2F11B9C7,0x1B2543CD,0xB1C91D4D,0x2B23E1EB,0xDF193F00,
0xBFBF0757,0x2507A5C9,0x1D4929E9,0xEDB3FF27,0x00F1BDBF,0x1B4B37E7,
0xC7A1FF3D,0x1BDDB1F5,0xFF3D0FD5,0xDFDBFF5B,0x43FDA7D1,0xF5613FC1,
0xE1F53D2F,0x19D1AFEF,0xFF3F47CB,0xC1CD333B,0x3DEBAB1D,0x153D07C1,
0xA9CF2D2B,0x27E59FFF,0xDF3F1BDB,0xADCD532F,0xEFB1A1EF,0x2D430FFD,
0xD3AD1D07,0x27C7ABFB,0x3F51E9CF,0xC1BF0D1B,0x2F03AFF9,0xF34FF9BF,
0xADDB393F,0x19C1B7E9,0xEF510FD1,0x0BFF3B00,0x1FA9CFCD,0xF55901C1,
0xADEB1F15,0x00E1EF1F,0xFF31E1F1,0x9BDF411F,0x33C1CFF1,0x1DFFFFE3,
0xB10D45FD,0x0FA5CFFF,0x2317131F,0xA715F92F,0xF9BFDB39,0x41E115FF,
0xF717CF39,0x00F1E90D,0x13B5C50B,0xFFF7D937,0x0BEF0001,0x00D3FFDB,
0x3713DBFF,0xEB230BEF,0x03C90017,0x2DE1FF07,0xDD15E1E1,0x21EFD9E1,
0x1907DFE1,0x074BF3D7,0xC9E11BDF,0xE7071311,0xBFFD0019,0xEBE743DD,
0x25FDE1E1,0xFFFFFBF5,0x0F0D1DC9,0x13DB0DF5,0xE1070B15,0xD1DF0F1F,
0xEFC7F113,0xD703C700,0xF1E7F300,0x2FE71DC3,0xE507EBDF,0xDBF117FF,
0xD9C917FF,0x1DEFE123,0xE7EFABE5,0x07EBDDE9,0x1FFBBF07,0xC31BFFEF,
0x27F125E1,0xF7D917FF,0xDD3D0F09,0xFFD700F7,0x1500E700,0x0F39D10F,
0xD911FFE7,0x0017EFE1,0xDFE5F11D,0xDB0033DB,0x1DBFBFF1,0x1BE7D1F9,
0xD12DEFD5,0xE90DF715,0xEF170DFF,0xBB13DB0F,0xFFEF0F07,0x3500DFE1,
0x1B1DEFF9,0x0BD71FDF,0xE9070DDB,0x0033001D,0xB9D923FF,0xEFEFDBE9,
0x15F1E907,0xE90D1DF1,0x2BDFEFB7,0xDF072DE7,0xE10F0F39,0x07C31315,
0xEF15E10F,0xDFEFE93F,0x13E519E9,0x1713FFE1,0xE7EB1519,0xE9D523D5,
0x27D31F1F,0xFFF7E929,0xE5EFD109,0x2FEBDD07,0xCF07F7FF,0x001BCFEF,
0x09B50DD5,0xDF001301,0x19F7D1FF,0x17BFE3CF,0x0F31DFE1,0xD92BC9FF,
0xF9130BD7,0x0D00EF00,0xE7F30005,0x1F17F5D9,0x33DF0DED,0xDF2D19DF,
0xE129E1CB,0x0F003109,0xB723FF15,0xBBF70013,0xFFE929E1,0xF9F3EF23,
0xE7EB23DF,0x00D90DC9,0x0FF3193D,0xC1E10FFF,0xD9DFE900,0xFFD1E13F,
0xC5FFDD1F,0x17F7FFE1,0x29D1FFE7,0xE900EB29,0x23CF0FFF,0x11E1FF0D,
0xFF27B317,0xF1CFF935,0xFF07F723,0x15FFE527,0xFF271F03,0x00F5FFD9,
0x350FF1EF,0xD123FDDB,0xF5D1F117,0xFFE1EBFB,0xBFF7AFD9,0x07BFC9E1,
0x00F9DFC5,0x073DEBF7,0xE1C105D7,0xF10F0DF9,0xEFF900FF,0xDBB9F9C7,
0x35FFC9D1,0xB70F1FDB,0xE91D1DC9,0x3BDFF9CF,0xBF1F4DEF,0xE1EF00F9,
0xFFAF1FFB,0xBD29FFE1,0xD9CBE11F,0x0F0035D7,0xE1230D11,0xABC7232D,
0xE3C1FFE1,0x1FDFF517,0xD7B7EFFF,0x1FCFBFD9,0x45F5193D,0xC5F9EFFF,
0x2FD7B5FF,0x1DF117E7,0xC90FCD3B,0x37DBE1D7,0x1537D7C9,0x0315D137,
0x1107EFB7,0x1339DBC1,0xBFE9031D,0xD107FFB5,0x311D0FED,0xBFD107E9,
0x00EFD1F1,0x1DE729BD,0xA911150F,0x07DFF90D,0xE9073DD3,0xBB15ED3F,
0xE3B7F115,0x000F2100,0x09EFE54D,0xEDE9EFFB,0x2FFFE7E9,0xFFF12B3D,
0xE107DFF7,0x2BE7E115,0xFFE92B27,0x001FBB0F,0x37FFF5DF,0xF107FFD1,
0xF10BD333,0x150003D7,0xEF030D0F,0xFFE3E131,0xEB17E1C7,0x211D0517,
0xFFF5DFEB,0xF13D05E1,0x3F003BFF,0xCFF1F7F5,0x00150003,0xFFD127EF,
0xF715E72F,0x15FFD1D7,0xD10029DD,0x0F0BCD0F,0xCFE50BEF,0xD90125D1,
0x1DBBD913,0xDF1F15EF,0x00FFD1D1,0xFFC3010B,0xF137F7F1,0xE5DF1715,
0xF7E91DE7,0xE9FFC70F,0xF7D72F19,0x17EDDFC9,0x1DFFDD35,0xD90325DF,
0xF1E3D701,0xFF00000D,0xB9F1EFF9,0x2BD3E913,0x1500E7C7,0xD9FFD707,
0x27B900C7,0xF917EFDB,0x010D001D,0xE1D1FFBF,0x1D35D90B,0xD7F500FF,
0x00F7DF00,0x451F00F9,0xB7271DF7,0x3FF7CB09,0x1B1917B7,0xE1F7FF17,
0x0FCFB7D7,0x251725E7,0xB7093311,0xFDB5CF0D,0x1D3F1DE1,0xEFEF1F2F,
0xDFD1BDD1,0x371BCFC1,0xC9ED25EF,0xC9E5BFC7,0x0F2700EF,0xBD074521,
0xCBA1A90D,0x0DE900E1,0xD7D7011F,0xF7B7BB05,0x4131EFA9,0xD1F7252F,
0xF1E1E7FF,0x073FF9B3,0xB3F9272D,0xC9B197FF,0x1DDBD1E1,0x9FD91F00,
0xF1BF9F0B,0x573DF9B7,0xC1232D00,0x00C1EB25,0x0D1FFDA7,0xAFFD1F4B,
0xE7AFE11D,0x494BD9E1,0xFFFF253F,0xD9DBCFF3,0x434DF9B3,0xCB1F4D0D,
0xD1C9D71B,0x3D0500D7,0xA7FF4937,0xFFCFB92F,0x3505D3B5,0xE1331D27,
0xF1B3D7FF,0x001FDF91,0xC5F73325,0xB7A9F3FF,0x3701C9D1,0xDFDF233F,
0xF5D7AF0B,0x3F1DB1A9,0xCB2F2D07,0xF1F5AF0B,0x152707BF,0xCF2B451F,
0xE7B3E12B,0x2D3F2FB9,0xFF0D0F1F,0xF5B5D905,0x2F4BF7C1,0xCDFF451D,
0xC9F1D7F7,0x171FF1FD,0xCFF15F3B,0xE7BDB707,0x39F3E9E1,0xE9FB2D03,
0x00CFB70D,0x2F3F0DD3,0xC100153F,0xF1C1F92D,0x112FCBB1,0xF7E70747,
0x25C1BFED,0x372DCDA5,0xEFFD2DF3,0xE9D1B7CB,0x2F4717C7,0xB30037EF,
0xE1D9CB23,0x1D2117CB,0x9BEF1D1F,0x1BC7C10B,0x1B370BC1,0xE1FF3D3F,
0x00C1DBE7,0x0F431FE1,0xCFCF473D,0xD9B9C709,0x452FE907,0xC7CB3551,
0x17DFBBF3,0x4333E1B3,0xC1F93533,0x27B9BBFF,0x1D2F0FAF,0xBFFB0F2F,
0x1799A9FF,0x2D45EB99,0xBFFFFD1F,0xF9D1B7E7,0x2743F5A5,0xB7DF1F1D,
0xFDFFC1BF,0x0B03F1E5,0xD5FF130F,0x00CFDFDB,0x152D1FF9,0xE1C7EF09,
0xED0BF7F3,0x1D0013FB,0xBDE10013,0x3FE7D5E7,0xFF151BB9,0xD9E9F723,
0x19E7CFDF,0xED2727E9,0xD9ED002F,0xE9C1D9E7,0x113B2B00,0xBFD70F3D,
0x05FDFFF5,0x0F2D03F1,0xADC92D35,0x1711AFF5,0x190017FF,0xB703293B,
0x1FAFA1F3,0xFF0037D1,0xF9DBC715,0x33C3C5D7,0x073FEFB9,0xE9BDDD1D,
0xE700CFAF,0xF11DC1E1,0xBBC12735,0x0723ABC1,0xFFFF07ED,0xBBE119E9,
0x07EFB9D3,0xFF2937CF,0xB1EFFB1F,0x1BD300FF,0xBF3735E5,0xC7CFE947,
0xF7B1CDD1,0xF12DFFE1,0xDFB71125,0x00C1BFBF,0x07092307,0xC7B71335,
0x1FCF9DE9,0x27FB0000,0xABDDEF1F,0x33079DE3,0x291F11CB,0xC1F1251F,
0x37D1C1CF,0x154727C7,0xE5DF0037,0x15D9D5CF,0x2F5D17E1,0xB7DF1139,
0xF50FDBD5,0x114D1FD5,0xAFD34549,0x13D5C7CD,0x0D0D27E1,0xC9EF3333,
0x0FB3A9DB,0x034537E1,0xC1E7FF3F,0x03C5CF19,0x1D3F03C1,0xA9CF1345,
0x29D1CBF5,0x3115F1C9,0xDBEF3D41,0x27D1AFD7,0x393D00E1,0xBFEF2115,
0xE1E1B3FF,0x494F00DD,0xAFDF251F,0x0FD9C3E5,0x391FF9AB,0xC3F73D2F,
0x0FC3D1DF,0x133717CD,0xD90D273D,0xE1B9C9FB,0x194B00E1,0xCDF32343,
0xFDE5DF05,0x432300C9,0xC5F53927,0x23D3C7EF,0x250317CB,0xD115312B,
0x15C1BDFF,0x092BFBD1,0xC7FFF51F,0xE9D5CFFF,0x2935F3C9,0xBFDB2117,
0xF1E5DFDB,0x250BF5D3,0xBFE33B23,0x00DFCBF1,0x151500F9,0xCD2D11F1,
0xDBF9D725,0xC70DFDDB,0x000FEFC9,0xD5FB0D15,0xF7E1F7FF,0x0F00E1DF,
0xFFDF1B05,0xEBFFE11F,0x21DFE9C1,0xC91B0DE7,0xF1F5EFFF,0xC1D90BCB,
0xC1002F0F,0xFFC10725,0xEBD9D1D1,0x19DFD90F,0xFFEBCB03,0x1FFFDBE1,
0x13000DFF,0xE1E9EB19,0x11F100EF,0xFFE11DDF,0x0BC5D50B,0x2BD7D1CF,
0x0D17DBC7,0x00EFB5FB,0xE100DDBF,0xF1270FED,0xE7C9F10D,0xF7E1C9D9,
0x11EF00D9,0xEFE5FFD3,0x0003CFCD,0xE1092FDF,0xC3001D0D,0xDFFFE511,
0xF7F92300,0xBDDFF900,0x1BE7E10B,0x07FFFFCD,0xF1BF2323,0xF1E9FDFB,
0xE91D070D,0xD7BF0031,0xC9E1D507,0x1DFFC100,0xFFCBEFE9,0xF1F9CBE1,
0x2317FDBB,0xD9F10DEF,0x00D1F10D,0xF70000DF,0xFF2D0023,0x25FBCF1F,
0xDB31EFD1,0x003D1300,0x0B0F19F7,0xEB271DE1,0xDFF9371D,0xF3E92111,
0x19F7E52D,0xE7DF00F1,0x00FFCB00,0x1F13EF15,0xD11315FB,0xF1E1E1FD,
0xEFF107FF,0xFFDBE90B,0xFFCFF1F1,0x0F1BD5E1,0x171DCD05,0xF9FFFFD7,
0xD927DBED,0xEF0B070D,0xE7E9FFE1,0xFFFF0000,0xEBF500D7,0x13FFFBE9,
0x0DFF23D5,0xC9210DE7,0x03110B19,0xCFE5350D,0xC1FBF933,0xFFD50019,
0xFFF90D1F,0x13DFE71F,0x0FE10FEF,0x171B0B0B,0x07D9152D,0xF107F1EB,
0x23FDE92B,0xFFE9EF2D,0x1F15C7D5,0x1DFFF1D9,0x000FFFE9,0x2703E5CF,
0xFB1F27BD,0xDD05E109,0x09F900EF,0xDF2D03C1,0xD7F7E517,0xDF0BEFC9,
0xF11D1BE1,0xBBD527FB,0xD1F1FFE9,0x0DDB27FF,0xB7C32523,0xE5D7C107,
0x03D5030D,0xE1F7F727,0x00D7C51D,0x130709DD,0xEDD9FF3B,0x15E9CDD7,
0x2100FFE1,0xE100CDEF,0xF701E5EB,0xFF1FE1F7,0xFFF90743,0x050DBBED,
0x0FFFF1E1,0xE52115F1,0xE9FFD5AF,0x11232BCB,0xE1D9190D,0xCFD30723,
0xEF001FE1,0xFFE7F327,0xFFEDADF5,0x1325E7D5,0xF10BFF25,0xE10BFFFB,
0x1F2337FF,0xF5D93B1D,0xEFC9E117,0x33F7E9F5,0xD7DFEBF1,0x0B15A9FD,
0x0F23EBBF,0xD10BFFFF,0xD1D1D5EF,0xE3001FBD,0xEFBD0303,0xEFB1B9ED,
0x231DCDC1,0xF1F715E3,0xD9F1DBE7,0xD13507E7,0xAFDD1715,0xEFD1BB13,
0x19EFD100,0xEDDF11E5,0x0FE7B7F3,0x27270DDF,0xD10F1D03,0xF9E1FF1D,
0xF73FFDF7,0xDFD70733,0xEFC1D9FD,0x291DC9D9,0xFFD7FBED,0x17F5CFC9,
0x0F390DBF,0xC3131DF7,0xE1C9DDFF,0xEF131F07,0xAFEF0F27,0x1DCFE12F,
0x1515F3E1,0xE1FFFF1F,0x33F5FFF5,0x0F33FFDD,0xC5EB3F3D,0x00E1EFFB,
0x15F3E127,0xDBD5072F,0x17DFB700,0x4B25C5E1,0xD50DFFF9,0x0FF1F9D7,
0x190FFDC7,0xBFEB1B2D,0x07C1E9EF,0x0D3F00E1,0xEFFFF933,0x11C9D7E1,
0x254D03E5,0xBB1D25FB,0x0003E7E1,0x0F2F39F9,0xA1FD4919,0x15C9E50B,
0x15E91F17,0xCBFF1927,0x17CFC1EF,0x1B27FFE5,0xC9FF0D43,0xE5C9FFFF,
0x1907ED00,0xDFD70753,0x15C7EFDF,0x470DC9E9,0xFFF50D1D,0x17FFD5D3,
0x3D2FF5EF,0xE713172B,0xEBDBC100,0x4D11F1C9,0x0B27FFF1,0x03FFCDFB,
0x170F0FA7,0xC92F151F,0xEFDBE119,0xF30D07B5,0xFF1D030F,0xDBD5C7E9,
0x1F15FFC1,0xC9EF31E3,0xC501F7FF,0x27DF1FED,0xBF0029E1,0x01E12BE5,
0xEFD1CFFF,0x1D0B13E9,0xF3F7E70B,0x23F5FF13,0x1323BFED,0xE1EFEF09,
0xDF1331DF,0xC507F11D,0xFFDD0F0B,0xEDB3E9E1,0xFFFFF113,0x05F7EDC1,
0x00FFF7D1,0x0707FFCF,0xC900FFFF,0xEFE1171B,0xDBE1F10F,0xF705E103,
0x09BFD5E9,0x13FFDFF1,0x0029FFC7,0xD5F113DF,0xF127CBF5,0xEFD1E515,
0xC5E10007,0xFFCDA5F7,0xEFFFD9E9,0x00F7D9D1,0x00FDFDCD,0xE12BEFC7,
0xD5D10FEF,0xD5E91BFF,0xEFFBE103,0xF7DFD917,0x13F7D7E1,0xF1FFEFF1,
0xD5171DF7,0xE1E9FF0D,0xEBEB0F2B,0xCF000003,0x15CFC927,0x25EFE9E1,
0xF1FFC7E1,0x2F0711FF,0xCDD9EFDF,0xE5ED001D,0xEFC3F1FD,0x09F7D10F,
0x29FDD1E9,0xD917EFF5,0x2F3DEBF1,0xDF0FFFE7,0xF1374D17,0xF70007F7,
0xDF001B27,0x15F70017,0xFFDD0B00,0x2729E307,0x05DFFFDF,0xD9270DE9,
0x00170BFF,0xBF003915,0xF9D50007,0xDFCD0F1D,0x21FFDD07,0x1DBFD5F9,
0x0019FFE9,0x1F15D7F7,0xF5E11DFF,0xE907E903,0xDFED001D,0xFFE1E5F1,
0x0DCFCD07,0x192B00D5,0x0F15DBD1,0x270305EF,0xE11F11CD,0xD90F1719,
0xFF000FFF,0xDBF5E307,0xFFEF0000,0x0505EFE1,0x2315F707,0xE1072DD7,
0x001F1D13,0x0D071FFF,0xC1E12713,0x15EF1739,0xFFF3E30D,0x0BFFFF2F,
0x31E9FBF9,0x0323EFFB,0x23090BFF,0xE3E10DEB,0x07170009,0xF3DD00F5,
0xF7DFE90F,0x1BF3D1EB,0xDF13E7DD,0x1BFFDFE1,0xDFEDEFD7,0xDB2717EB,
0xFBC100EF,0xDFE1FDF5,0xF9F7F1F9,0xF7CDFFFD,0x130DD700,0xE9FFF5ED,
0xF90FFDFF,0x15EB13AF,0xFFDBE10F,0x1FF5D1BF,0x0DEBEFF9,0x1FFF0D0F,
0x0907CFED,0xE519FBEF,0xD7F137E7,0xCB00D100,0x15FF00FF,0xEFC7EFE1,
0x00FFEBC1,0x00FFFBC7,0xE91119CF,0xE9D1F1EB,0xDFF10F1D,0xEBCD0007,
0xFDCFC10F,0xEF29EBE1,0xD9DFE100,0x1F070B0D,0xD127FFDF,0xD7CF0019,
0xFFD1D9E9,0x13EFCD0F,0xF3E7FBD3,0x00F3AFDD,0x031F15F5,0xA5F9FFDF,
0xE9D1D9FF,0xF3F1F1F7,0xAFE7EB17,0x0BBFC9D1,0xEF2BE5E1,0x000DFF17,
0x0FE9FBD7,0xF54B0DE7,0xCFF5133D,0xD9E1070D,0x2519D100,0xBFDFFF00,
0x0009DB00,0x390DF7BF,0xA70915FB,0x0FD1F1FB,0xDF001FF7,0xDBEFF129,
0xDFA9C903,0x2733E1E9,0xF9FFDF17,0xF90FFBFB,0x273FF3D1,0xCB00332D,
0xF7F105EF,0x1DEBE1F9,0xFFFF3F33,0x17F7CBF1,0x331DFBD9,0x0035FF0F,
0x00F5FFFF,0xF13315C7,0xCFF91735,0xE3E11F15,0x0DDFE5E1,0xFFFB071F,
0x00D5CDE9,0x1F1DEFDF,0xDD1F1DFF,0xCDF1DF19,0x13F1F9FB,0xDFE91B0F,
0xFFDFCF03,0x35E3E5D3,0x07211DF1,0x00FBEBFF,0xF907F1DB,0xE1030F17,
0xDFD7F12B,0x0D11E5D5,0x11FBEF00,0x01F519FD,0x0F27F7BF,0xF3F72F15,
0xE1F10F09,0xF109E917,0x150D1F21,0xF3EFDF00,0x1715FD00,0x011F2DDB,
0xF1EBFB11,0x19F11FF7,0xD1F70F00,0x17DFE92D,0xFFF5D1D9,0xE90DEF07,
0x07F1EDEF,0xE907DFD5,0xF3EB17FF,0xCFC1F5DD,0x1D0DE9FD,0xFBD3F9EB,
0xE1E7DBF1,0x2519CDE1,0xC30F0DFF,0xF100EF00,0xF7F100E3,0xDB1B2307,
0x0FBDE1F9,0x11FD05D5,0x0033F900,0xF9D9051D,0x001FFBCD,0xDB2B1307,
0xFF031D03,0xF100D1CF,0xF1E929D9,0xE7E9130B,0xFFBF0F19,0x070BE1F1,
0xF9CFF10B,0x0FFFDBE1,0xFB15EBC9,0xD9131DFB,0x07F1DFDF,0xBFE111EB,
0xCBDD1705,0xEFBB0011,0xFFE5E1E1,0xFDCBDF00,0x1BFFCFE9,0x0717DBBF,
0xE9E71DFF,0xE1E9E5CF,0xE90000FF,0xFFD9370D,0xEFB3C100,0x2DFF00F3,
0x0BFFD7C1,0x13E7B7F3,0x001FFBAB,0xC50F1B15,0xFFD107FF,0xE7E9D1E1,
0xFBEF170F,0xFFCDC7D1,0x1BFFD3F1,0x031943E5,0xE5F7DFDD,0x113713EB,
0xC9004513,0xF1E12739,0x1D0003F3,0xEFF70527,0x27B5F11F,0x1B1DDFD1,
0x271D0DEF,0xE1C9EBE7,0x071FF3DF,0xCFDD1FFF,0xDFC9E127,0x25E5E1F9,
0xF7FFFBE1,0x13DFC7ED,0x2313EFC5,0xF5332DDF,0xE1DD0BFF,0x05070F19,
0xE7FB0F0B,0xE7DB001B,0x2D15CBE1,0x010D0013,0x00192DE9,0x131BEBDF,
0xE3173B0D,0xE1D90D0B,0xEFE10FFF,0xF701F119,0x0BCBF123,0x1DFFE7E9,
0xF5FFCFD5,0x00F5FFFF,0x07070DDF,0xC7071BFF,0xF3E91709,0x0DC9E103,
0xFFFB0313,0xFDF7D7E5,0x230DDF13,0x1729FFEB,0xC9FFF7DD,0x111717FF,
0xD1E9FF0D,0xEFE72719,0xFFDBE9E1,0xF9FFE323,0x1FF7EBDF,0xEB0DF7DD,
0x001FF517,0xE9E9FFFF,0xFD0F19FB,0xFFE1E10B,0xFFEDEB00,0x330DFDE1,
0xE7FF09F7,0x0F25D9E7,0x07F913EF,0xCB1B2517,0xF3F5E1FB,0xF7001F00,
0xEFEFF10F,0xEDCFDDD9,0x131DFBC9,0xF1DF1923,0xE3FD09E7,0xF101F1D5,
0xD5E11F35,0xE5D9C907,0x15F7E51F,0x000D0F00,0x2FC5EBF7,0x2315F7DF,
0x00E90DFF,0xF5F53911,0x1D0000FF,0xBFF1030F,0x1DFDD500,0x25EFB900,
0x0F25EFF1,0xE1FBE7CF,0xD90F09DF,0xE50700DF,0xDFDD0F0D,0x0DEDF1F3,
0xF7E7E500,0x1DF7FBF1,0x0FFFCFE1,0x01451DF5,0xE90BEFDB,0xE10F190D,
0xDF172BEF,0xC7C50017,0x15D1F503,0xF7D7D1E9,0xF5D7E700,0x07F3BFBB,
0xD907EBFF,0xC9000DEF,0xC3D1E5FF,0xEFE50019,0xD7A5C900,0x13D7D1F1,
0x1BFFD5C3,0xF10DEFF5,0x2F0FFFEB,0xD70015EF,0xE3000027,0xFDC100FF,
0x1D15E907,0x1DEFE1F1,0x1F1DE7D1,0x1F1DFDD3,0xC50F15CF,0xE10701FF,
0xDFE107FF,0xBFF10F1F,0x11D7C5E9,0xF7EFDFE1,0x0015EFD1,0xE9FF19F7,
0x002F39F7,0xD3E90F21,0xE7E52713,0xFFEFD900,0x11EFF927,0x1F1BF7DB,
0x13FFFFF7,0xED1725EF,0xE1F1010D,0xF3E5271D,0xDFD1E117,0x1DEBF12F,
0x2BFFEBE1,0x07FBCFE5,0x13230BDF,0xD1F10DEF,0xFBF10F25,0xFFD9E1F9,
0x0DF7F50F,0x29EBCDD5,0x031DE7E1,0x172D09E3,0xD5000DEF,0xED331FFF,
0xE7E907FF,0xDDDB1327,0x19EFF1F9,0xEFEF0000,0x23FFDF00,0x0F0DFBDB,
0xF13D25ED,0xE9E3F7FF,0xE1032F0D,0xDDF9170F,0xE7C7003B,0x3103E100,
0x0BEFFD0F,0x0D0DFF00,0x1F17CFD9,0xF50F3D0D,0xE1F3FFFF,0x0DF1001D,
0xFF001F17,0xFDD7DD27,0x3D07CDD1,0x0015DBD9,0x00F50D15,0x0F0FEFBF,
0xE9190F0D,0xEBE10BFF,0xEFDDC9ED,0xFF050F03,0xDFE7D500,0x2BFFDDF5,
0xF125FFB9,0xD1F7EF07,0x0F00FFD7,0xC5171BFF,0xD3E92F29,0xF5E1E1FD,
0xFDE7F70F,0xE50FC7FF,0xDDED0F33,0x07E5EBFF,0xD7DDF141,0xFFFF1B17,
0x1FBFE9E9,0x11DF00F7,0x0F39CDC1,0x03E5CFFF,0x001FE7EF,0xB1F500FF,
0xF7F5030D,0xFDEDA3E9,0x0DFFE507,0x07F7C9BD,0x1F11FFDD,0x002925D7,
0xC5E90DC9,0x09130300,0xB7EB000F,0xEFF7FB17,0x25E5E9D9,0xD915EFE9,
0x27D7E5DB,0xD5F115CD,0xE93527FF,0xB9A1EFFF,0xDB00F900,0xCFD9E119,
0xB7AFDB0F,0x2DDFBBD1,0xCDD9EFDF,0xE9FFFBE3,0x3BE1FBDB,0xDD002D19,
0xF5B7E91D,0x0DE1F9DF,0x1515DF0F,0xFFC7E51B,0x2F37EFB1,0x191DFFEB,
0xCBE9350D,0x13E9D9DB,0xFBFD1F31,0xE7FBCDE1,0x0FD7C1F1,0x094729C5,
0xD1FFDFFF,0x1BF11DEB,0xE7172DC7,0xCBDF2749,0x1DE500CD,0xFFF7000F,
0xFFFF2729,0x0FFFBFD1,0x2B2D2117,0xD10F1DE7,0x0005FB15,0x15002FED,
0xAFC3FD2F,0x2DDF0009,0x19EFD7C9,0x0FFF0943,0x00E1DFCB,0x002BFFFF,
0xF7F10725,0xC1C1E909,0x451D0300,0x15CFE51F,0x23FFF7F9,0x3F0DF3B7,
0xF11F3935,0x0F13CD1D,0xF5EB1315,0xFF2F0F13,0x19EFB923,0x3D090FD1,
0x0011E3E1,0xFF15FFFB,0x1F1FFFB7,0xD1F32F0D,0xD91F13D7,0xD1F3E10D,
0xEFED2F27,0xB5FFD900,0x190D1327,0x13F1FFD1,0xD9F5FF17,0x0F0F2FDF,
0xD3D9F715,0x19E92F3D,0xD5DD00EF,0x1DEFE53D,0x15D9C3ED,0xD1EFDF17,
0x3907EFEB,0xED00BFD7,0x17ED0F0D,0xE3B1E1AF,0x1113C509,0x1DDBC9EB,
0xD1EBDFE1,0x3B3BC1D7,0xC707EFDF,0xF12505F1,0xFFF1F1BF,0xCF3F3D00,
0x21C7F1ED,0xDF002FE1,0x0B3D1FF1,0xC7EF0033,0xF1FFFBF5,0x153DE100,
0xC92500ED,0x0017EF0D,0x250F00DF,0xE1E927FF,0xE1DB1F2D,0xFFB303F1,
0xE9EFED00,0x47EBCBF9,0x0FF9D7C9,0xE91B1DF7,0xD1E9EFDF,0xD3F1F5FF,
0xDFE10013,0xD7ADC1FF,0x1BDFC5D9,0x0BCFE7D5,0x00FFEBBB,0x1713EBAF,
0xD7002BF7,0xC5C9E507,0xFFC9D1DF,0xEFFFD9E5,0xF1BFB9F5,0x1F1BD7B5,
0x072D15C9,0xC1F51DFF,0x000FFDB7,0xBFF52BFF,0xB7D5073D,0xFFDDE1FD,
0xEFE72F2F,0xF9DFE70F,0x33EFD1CD,0x0F3335E1,0xE1BDFF1D,0x00000BDB,
0xE31F2327,0xCDA90B5D,0x3BF3C5E9,0x15FF001F,0x11FBEB07,0x3FF7BBBD,
0x002F2DCD,0xC9F1EF15,0x1DE1F1FF,0xF70F27F1,0xCFCFE537,0x3DF7A9C1,
0x1D25EFC1,0xDDFF19F7,0x070FD7AB,0x003745F7,0xBFE5450D,0xE5F100FF,
0x15032F11,0xB7D7F92F,0x25DFD1E1,0xFD35FBD1,0xF5FFFF47,0x00E9F7CF,
0xE12F45FF,0xDFC91B3B,0xE5B1D907,0x19F70713,0xFFC7CF13,0x37F7CD00,
0x331905D9,0xE51FFFFF,0x3F1FD7FB,0xEF0731FF,0xEB17172B,0x1DDBD9DF,
0x250DE900,0x1DEFE5E1,0x032DDFC7,0x273DF7D5,0xC1E521F7,0xDB1F1FDF,
0xEFEF000D,0xEFC9071F,0x09E7E1D1,0xFFF71BE5,0x0F0DEFE1,0x00EF0DDF,
0xCB1F3DF3,0xD1E5DF0D,0xEFD92731,0xCFED1F1F,0xEFBFD11F,0x2DFFD7E9,
0x07DBFF0F,0x00F7FFDF,0x1F23EBD7,0xF1D92731,0xD1C1E1F7,0x190DC9F9,
0xFFDFE327,0xF9DFCFE1,0x3733E1BD,0x1D0FE7FF,0x0DFFF1AF,0x27D9E3D1,
0xFFFFC3FF,0x17FFF7BF,0x0F1D3D03,0x05C1D7FF,0xDF00EFE3,0x1DFF23E1,
0xEFDDB7F1,0x2729B1EB,0xD9EB0DBB,0xC10925ED,0xD30FF1EF,0xC5002FD3,
0xDBAF070B,0xEFD1F11B,0x15FD2307,0x0DDDEB3F,0xF71DE7F3,0xE90D05FD,
0xF1F11D3D,0x0023FF1D,0xE1D70711,0xFFC11527,0x3BDBBF07,0x09FF1DE5,
0x00E5DFE5,0x00F1CD15,0xC10FF9F7,0xD1A1C11F,0x0DC9C109,0xEF25C1D1,
0x00DFDFC1,0x3507EFAF,0xE5230DD9,0xE9C10711,0xEFE9E9DB,0xEF03D11F,
0xBFCFE109,0x1F29BFC9,0xFB2DF3D5,0xC1151DE7,0x17F10FBF,0xD70027EF,
0xB1D70025,0xFFB9E100,0xBF1D050F,0xDDDFC113,0x0705DFD1,0xE923FF0F,
0xA1D51DFF,0x00E5FFC5,0xFFE51F27,0xCFB90F0D,0x2FCFA9D1,0x2DFF071F,
0xE115F71B,0x1F15D7F7,0xFF271DF9,0xB9C9E93F,0x15CF00FD,0x3D1DEBD1,
0x0FEFEF47,0x2F0701CD,0x0F45FFCF,0xDF170D2D,0xD3D1D1EB,0x25311F00,
0xFFEDF93B,0x29DFDB00,0x631537B9,0xCF192D05,0x2F1DDB0D,0x07133FD7,
0xC12B435B,0xF5E5C1FF,0xFFF500E1,0xDFF7071F,0xD7E5BFC7,0x4725FBB9,
0xD1C12B09,0xC100FFDF,0x23FF00D7,0xB7C52347,0xC1CBC50F,0x0DF7F1EF,
0xED05FF27,0x00BBBD0F,0x071725B5,0x00F9FF1B,0x01C10735,0x13F90FC3,
0x1BEFF54B,0x25F1BB11,0x0F1DC7E1,0x131F2F11,0xF10FBFF3,0x3B0B0FEF,
0xEF003FD1,0x1511D10D,0x3D0500BF,0xE1FF05E5,0x1739E109,0xD943E7B7,
0xE915292F,0xC70F17DD,0xB93D21F1,0xFFD14319,0xC3C11D17,0x00FF2DF9,
0x1795EFF5,0x0FFD2D17,0xD1E1270D,0xC1C1000D,0x3D33110F,0x9DDBDD4B,
0x0FC7F70B,0x63079DD1,0xC9012D0D,0xE1CDBF9F,0x23D9C1DF,0xEFDDE923,
0xCB8B9307,0x491DB191,0xBF11CBD5,0x00F7D7D7,0x4F2FCF89,0xBB53111D,
0xE9D1F1DF,0x0D000FBF,0xD72B1F31,0xBFB3E1FD,0x432DD9C9,0xB72D25F1,
0xA9DDDFF9,0x472F25A7,0x93193D1D,0xB1AF0F2D,0x1BCD00C1,0x9FFF3F4F,
0xF1B7C52B,0x37F7D7B5,0x012FFF57,0xC9C5EF1D,0x3F1FDFA1,0xBF002B3D,
0xB1A9D11D,0x43C9B1AB,0xF7FF2717,0x00EF971B,0x55FFBBBF,0xE95B15F1,
0xA1C1C12D,0x2D07E19F,0xFF05000F,0xBFBBF135,0x6D3BC19D,0x0D0D0DE9,
0xA1EBEFEB,0x0F2BBD8B,0xDB535915,0xA9E5BF25,0xE30007DB,0xE7533D00,
0xB39FCB5F,0x4BF71FC1,0x07352D00,0xEFDF0D3D,0x2FEDE7A7,0xC905573D,
0xC3F1F94D,0x11CFBB13,0x1DFF4F07,0xBDF1C717,0x3FFFCFEB,0x27DD31C7,
0xA9C9F955,0x4F0FE1FF,0x19DF2927,0xEFE7EF4F,0x0D279BBF,0x37452D03,
0x11D11D11,0xFF2FE9DF,0x472727FB,0xFFAB153D,0x152DC1C1,0xFF1DE9E1,
0x1709FF37,0x0723BFB5,0xD7553FC9,0xF1D9EF0B,0x0DE50BEF,0xD71547AD,
0xEBBFE917,0x5327F11F,0xCD3D39C1,0xC1FF0921,0x1100B7FF,0xAF1D5D31,
0xDBC73DFD,0x1DE1BD00,0x1FFF5B37,0xD19F15E3,0x3B1FBFEB,0xE9090027,
0xA1A31D49,0x3D0FB3E7,0xDFF1E137,0xE99FFF27,0x3BB5A9A3,0x0D4509FF,
0x079DD72D,0x2FE1E9D3,0x135FF1EF,0xCBCFD51D,0x512F2DC5,0xCB1BDFEB,
0x091F0BFF,0x4B1300E1,0xDF2B2F1D,0xFF13A9BF,0x15DF00E1,0xE7571D1F,
0xD1FFCDBF,0xFD2721AF,0xCDC9FF0F,0x87CF1329,0x0DE50FB9,0xFBCF0037,
0xCFBFC1FF,0x00FDCFC9,0x070B114F,0xC5F5F71D,0x3F1B0F11,0xEFC11B0D,
0xABC1C737,0x4BDFC1C5,0xFFD3FFC5,0xF1FFAD31,0x2FE9DFBF,0xE1333D1D,
0xE7C5A90D,0xEBE1E9AB,0x2515F5E9,0xEF8993FF,0x3F2FCDB9,0x13E72DCF,
0xCD0FFFFF,0x1F2DD1A7,0xB7034FFF,0xC927AB1F,0xDFE500CF,0xC72D3F17,
0xFFB7BF37,0x15350DB3,0xF5E70DE1,0xD1C11F3D,0x0033FFCF,0xDBEF172F,
0xC7A5F14B,0x07098DD1,0xFBEB3927,0xC9D1D7E9,0x1721BBDF,0xE9073DE7,
0xC182B72D,0x1DF1E1EF,0xB5EF1307,0x07BFE171,0x2D2FA5AD,0xE93D0327,
0x3DDBEFFF,0x0027BFAB,0xE1295315,0xEBC1DFEF,0x4D17C9F5,0xDF092FC9,
0xF1DFBF23,0x6939A5C7,0x9D251DD5,0xE113FF1F,0xFF1FCFBF,0xAF39651F,
0xDBC50FF1,0x1D1FE1CB,0x1D4D4113,0xC1AB25FF,0x1F57D7C1,0xC93D232D,
0xA1B73D3B,0x07F1B1D1,0xBF093F4B,0xF1A31D07,0x1FB7CDCD,0xE75537E7,
0xC193DF55,0x4FC3070D,0xCF33DF01,0xCDBFF57B,0x63C9CBC3,0xFF3BFF00,
0x2DD7F51D,0x4FD1BBBF,0x4B65472B,0xC7E900FF,0x5F0FBD0F,0x55570F07,
0x9D15DFEF,0x6D35B1A5,0xFF1729C5,0xD1454BF9,0x1DCDE187,0xDF4F4500,
0xB9DF001B,0xABEF0F9D,0x115703F1,0x89AF1347,0xD52335B5,0xFF0925E9,
0x9FB93D51,0x07C71FD1,0xCD0F174B,0xC1BFCF0D,0x0525E9E5,0xD91937E1,
0x0F00CF39,0x671707BF,0xED076900,0xF7F10F65,0x29D500F9,0x0F0DF907,
0x2BCFB1FF
};
/* Clock image run-dump. */
USHORT ClockMap[456] =
{
0xFFFF,0xFFFF,0x8000,0x0FFF,0xFFFF,0xFF80,0xFFFF,0xFFC0,
0x1FFF,0x801F,0xFFFF,0xFF80,0xFFFF,0xF80F,0x8000,0x0F80,
0xFFFF,0xFF80,0xFFFF,0xC1C0,0x3FFF,0xE01E,0x1FFF,0xFF80,
0xFFFE,0x081F,0xF9F0,0xFFC0,0x43FF,0xFF80,0xFFF0,0x81FF,
0xF1E6,0x7FFC,0x087F,0xFF80,0xFFC0,0x0FE7,0xF9FE,0x7F3F,
0x800F,0xFF80,0xFF00,0x7FF3,0xF9F8,0xFE7F,0xF005,0xFF80,
0xFE01,0xFFF9,0xF9F3,0xFCFC,0xFC02,0xFF80,0xF803,0xFFFF,
0xF9E6,0x7FF3,0xFE00,0x7F80,0xF00C,0x7FFF,0xE060,0x7FCF,
0xF180,0x2F80,0xE01F,0x8FFF,0xFFFF,0xFF3F,0x8FC0,0x1780,
0xC03F,0xFFFF,0xFFFF,0xFCFF,0xFFE0,0x0B80,0xC07F,0xFFFF,
0xFFFF,0xF3FF,0xFFF0,0x1580,0x80FF,0xFFFF,0xFFFF,0xCFFF,
0xFFF8,0x0B80,0x80C3,0xFFFF,0xFFFF,0x3FFF,0xFE18,0x0580,
0x0199,0xFFFF,0xFFFC,0xFFFF,0xFCCC,0x0280,0x0199,0xFFFF,
0xFFF3,0xFFFF,0xFFCC,0x0500,0x01C1,0xFFFF,0xFF8F,0xFFFF,
0xFF1C,0x0280,0x01F9,0xFFFF,0xF021,0xFFFF,0xFFCC,0x0500,
0x01F3,0xFFFE,0x01F8,0x7FFF,0xFCCC,0x0280,0x80C7,0xFFC0,
0x3FFE,0x1FFF,0xFE18,0x0500,0x80FF,0xFC01,0xFFFF,0x87FF,
0xFFF8,0x0A80,0x807F,0xF81F,0xFFFF,0xE0FF,0xFFF0,0x1580,
0xC03F,0xFFFF,0xFFFF,0xF83F,0xFFE0,0x0B80,0xE01F,0x8FFF,
0xFFFF,0xFE0F,0x8FC0,0x1580,0xF00C,0x7FFF,0xFFC7,0xFF03,
0xF180,0x2B80,0xF803,0xFFFF,0xFF9F,0xFFC1,0xFE00,0x5780,
0xFC01,0xFFF9,0xFF3F,0xFCFF,0xFC00,0xAF80,0xFE00,0x7FF3,
0xFF07,0xFE7F,0xF001,0x5F80,0xFFC0,0x0FE7,0xFF33,0xFF3F,
0x800A,0xBF80,0xFFF0,0x81FF,0xFF33,0xFFFC,0x0855,0xFF80,
0xFFFE,0x081F,0xFF87,0xFFC0,0x02AF,0xFF80,0xFFFF,0xC1C0,
0x3FFF,0xE012,0x157F,0xFF80,0xFFFF,0xF80F,0x8000,0x0F80,
0xABFF,0xFF80,0xFFFF,0xFFC0,0x18FF,0x8015,0x5FFF,0xFF80,
0xFFFF,0xFFFE,0x8000,0x0AAB,0xFFFF,0xFF80,0xFFFF,0xFFFF,
0xFD55,0x55FF,0xFFFF,0xFF80,
0x0000,0x0000,0x7FFF,0xF000,0x0000,0x0000,0x0000,0x003F,
0xE000,0x7FE0,0x0000,0x0000,0x0000,0x07F0,0x7FFF,0xF07F,
0x0000,0x0000,0x0000,0x3E3F,0xC000,0x1FE1,0xE000,0x0000,
0x0001,0xF7E0,0x060F,0x003F,0xBC00,0x0000,0x000F,0x7E00,
0x0E19,0x8003,0xF780,0x0000,0x003F,0xF018,0x0601,0x80C0,
0x7FF0,0x0000,0x00FF,0x800C,0x0607,0x0180,0x0FFA,0x0000,
0x01FE,0x0006,0x060C,0x0303,0x03FD,0x0000,0x07FC,0x0000,
0x0619,0x800C,0x01FF,0x8000,0x0FF3,0x8000,0x1F9F,0x8030,
0x0E7F,0xD000,0x1FE0,0x7000,0x0000,0x00C0,0x703F,0xE800,
0x3FC0,0x0000,0x0000,0x0300,0x001F,0xF400,0x3F80,0x0000,
0x0000,0x0C00,0x000F,0xEA00,0x7F00,0x0000,0x0000,0x3000,
0x0007,0xF400,0x7F3C,0x0000,0x0000,0xC000,0x01E7,0xFA00,
0xFE66,0x0000,0x0003,0x0000,0x0333,0xFD00,0xFE66,0x0000,
0x000C,0x0000,0x0033,0xFA80,0xFE3E,0x0000,0x0070,0x0000,
0x00E3,0xFD00,0xFE06,0x0000,0x0FDE,0x0000,0x0033,0xFA80,
0xFE0C,0x0001,0xFE07,0x8000,0x0333,0xFD00,0x7F38,0x003F,
0xC001,0xE000,0x01E7,0xFA80,0x7F00,0x03FE,0x0000,0x7800,
0x0007,0xF500,0x7F80,0x07E0,0x0000,0x1F00,0x000F,0xEA00,
0x3FC0,0x0000,0x0000,0x07C0,0x001F,0xF400,0x1FE0,0x7000,
0x0000,0x01F0,0x703F,0xEA00,0x0FF3,0x8000,0x0038,0x00FC,
0x0E7F,0xD400,0x07FC,0x0000,0x0060,0x003E,0x01FF,0xA800,
0x03FE,0x0006,0x00C0,0x0300,0x03FF,0x5000,0x01FF,0x800C,
0x00F8,0x0180,0x0FFE,0xA000,0x003F,0xF018,0x00CC,0x00C0,
0x7FF5,0x4000,0x000F,0x7E00,0x00CC,0x0003,0xF7AA,0x0000,
0x0001,0xF7E0,0x0078,0x003F,0xFD50,0x0000,0x0000,0x3E3F,
0xC000,0x1FED,0xEA80,0x0000,0x0000,0x07F0,0x7FFF,0xF07F,
0x5400,0x0000,0x0000,0x003F,0xE700,0x7FEA,0xA000,0x0000,
0x0000,0x0001,0x7FFF,0xF554,0x0000,0x0000,0x0000,0x0000,
0x02AA,0xAA00,0x0000,0x0000
};
/* This one binds the clock image data. */
struct Image ClockImage =
{
0,0,
89,38,2,
(USHORT *)ClockMap,
0x03,0x00,
(struct Image *)NULL
};
/* The gadgets for the clock window. */
struct Gadget ClockGadget[2] =
{
&ClockGadget[1],4,2, 88,38,GADGIMAGE | GADGHBOX,GADGIMMEDIATE | RELVERIFY,BOOLGADGET,(APTR)&ClockImage,NULL,NULL,0,NULL,0,NULL,
NULL, 0,0,294,42,GADGHNONE, GADGIMMEDIATE, WDRAGGING, NULL, NULL,NULL,0,NULL,1,NULL
};
/* The clock window definitions. */
struct NewWindow NewClockWindow =
{
0,0,
294,42,
1,3,
GADGETUP,
ACTIVATE | RMBTRAP,
(struct Gadget *)&ClockGadget[0],
(struct Image *)NULL,
(STRPTR)NULL,
(struct Screen *)NULL,
(struct BitMap *)NULL,
0,0,
0,0,
WBENCHSCREEN
};
/* Some more information text. */
struct IntuiText ClockTxt[4] =
{
{1,0,2,98, 2,&DefaultFont,(UBYTE *)"This is DClock trying to",&ClockTxt[1]},
{1,0,2,98,10,&DefaultFont,(UBYTE *)"wake you up. Click the",&ClockTxt[2]},
{1,0,2,98,18,&DefaultFont,(UBYTE *)"clock to proceed.", &ClockTxt[3]},
{3,0,0,98,31,&DefaultFont,(UBYTE *)"Alarm time » 12:12:12 « ", NULL}
};
/* Define the handler code as a function. */
extern void Handler();
/* Some inline assembly code to deal with the
* input.device handler interrupt.
*/
#asm
_Handler: MOVEM.L A4,-(A7) ; Save base register
MOVEM.L A0/A1,-(A7) ; Push both arguments onto stack
JSR _geta4# ; Adjust the base register
JSR _MyHandler ; Call the handler routine
ADDQ.L #8,A7 ; Clear the contents of the stack
MOVEM.L (A7)+,A4 ; Restore the original base register
RTS ; Pass it to the next handler...
#endasm
/* MyHandler(Event,MyData) :
*
* This is the main interface to the handler
* routine.
*/
struct InputEvent *
MyHandler(Event)
struct InputEvent *Event;
{
/* User wants to toggle text and memory mode. */
if(Event -> ie_Class == IECLASS_RAWKEY && Event -> ie_Code == 0x5F && Event -> ie_Qualifier == 0x8080)
{
Event -> ie_Class = IECLASS_NULL;
if(DSeg -> Child)
Signal(DSeg -> Child,SIG_TOGGL);
}
/* If we can use it, initialize the copyevent and signal
* the main process to produce a click.
*/
if(Event -> ie_Class == IECLASS_RAWKEY && !(Event -> ie_Code & IECODE_UP_PREFIX) && DSeg -> Click)
{
CopyEvent . ie_Class = Event -> ie_Class;
CopyEvent . ie_Code = Event -> ie_Code;
CopyEvent . ie_Qualifier= Event -> ie_Qualifier;
/* This is safe from interrupt code, or
* at least should be.
*/
if(DSeg -> Child)
Signal(DSeg -> Child,SIG_CLICK);
}
/* I had a lot of trouble getting DClock-Handler to
* work with timer.device. Well, the only thing
* happening in time were system crashes, so I
* decided to use the timer entries of the
* InputEvent structures.
*/
if(Event -> ie_TimeStamp . tv_secs != DSeg -> LastSecs)
{
DSeg -> LastSecs = Event -> ie_TimeStamp . tv_secs;
if(DSeg -> Child)
Signal(DSeg -> Child,SIG_TIMER);
}
return(Event);
}
/* Click() :
*
* Produces the click (or what did you expect?).
*/
void
Click()
{
struct Message *AudioMsg;
char PrimaryBuffer[11]; /* Rawkey conversion buffer. */
register short i;
/* Erase the buffer. */
for(i = 0 ; i < 11 ; i++)
PrimaryBuffer[i] = 0;
/* Convert the input event according to the
* current keymap settings.
*/
RawKeyConvert(&CopyEvent,PrimaryBuffer,10,NULL);
/* If it didn't produce a sensible result,
* don't click.
*/
if(!PrimaryBuffer[0])
return;
Audio -> ioa_Volume = DSeg -> ClickVolume;
/* If it's still resounding, abort it. */
Tick: if(!CheckIO(Audio))
AbortIO(Audio);
/* Let it click. */
BeginIO(Audio);
}
/* FlushSound() :
*
* Send the sound control data to NIL:
*/
void
FlushSound()
{
/* Audio device still open? */
if(Audio -> ioa_Request . io_Device)
{
if(!CheckIO(Audio))
WaitIO(Audio);
/* Free the channel(s). */
Audio -> ioa_Request . io_Command = ADCMD_FREE;
DoIO(Audio);
CloseDevice(Audio);
}
/* Free the audio control block. */
if(Audio)
FreeMem(Audio,sizeof(struct IOAudio));
/* Delete the replyport. */
if(AudioPort)
DeletePort(AudioPort);
}
/* InitSound() :
*
* Sets up the audio control structures.
*/
BOOL
InitSound()
{
if(!(Audio = (struct IOAudio *)AllocMem(sizeof(struct IOAudio),MEMF_PUBLIC | MEMF_CLEAR)))
return(FALSE);
if(!(AudioPort = (struct MsgPort *)CreatePort(NULL,0)))
return(FALSE);
/* Try to allocate a vacant channel. Sam Dicker suggests
* channel allocation precedence 90 for annunciators.
*/
Audio -> ioa_Request . io_Command = ADCMD_ALLOCATE;
Audio -> ioa_Request . io_Message . mn_Node . ln_Pri = 90;
Audio -> ioa_Request . io_Message . mn_ReplyPort = AudioPort;
Audio -> ioa_Data = AnyChannel;
Audio -> ioa_Length = 4;
/* Open the channel. */
if(OpenDevice(AUDIONAME,0,Audio,0))
return(FALSE);
/* Prepare it for the click. */
Audio -> ioa_Request . io_Flags = ADIOF_PERVOL | ADIOF_NOWAIT;
Audio -> ioa_Request . io_Command = CMD_WRITE;
Audio -> ioa_Period = 180;
Audio -> ioa_Volume = 0;
Audio -> ioa_Length = 270;
Audio -> ioa_Data = (UBYTE *)SoundData;
Audio -> ioa_Cycles = 1;
/* This first sound will not be heard since
* the audio.device needs a sound to be played
* at least once to work properly. Since there
* was no keypress yet, don't confuse the user.
*/
BeginIO(Audio);
WaitIO(Audio);
/* Adjust the volume now. */
Audio -> ioa_Volume = 64;
return(TRUE);
}
/* InitHandler() :
*
* Open the console.device for keymap translation
* and add the input.device handler.
*/
BOOL
InitHandler()
{
if(OpenDevice("console.device",-1,&ConStdReq,0))
return(FALSE);
ConsoleDevice = (long)ConStdReq . io_Device;
if(!(InputDevPort = (struct MsgPort *)CreatePort(NULL,0)))
return(FALSE);
if(!(InputRequestBlock = (struct IOStdReq *)CreateStdIO(InputDevPort)))
return(FALSE);
if(OpenDevice("input.device",0,InputRequestBlock,0))
return(FALSE);
HandlerStuff . is_Code = Handler;
HandlerStuff . is_Node . ln_Pri = 60;
HandlerStuff . is_Node . ln_Name= "DClock-Handler";
InputRequestBlock -> io_Command = IND_ADDHANDLER;
InputRequestBlock -> io_Data = (APTR)&HandlerStuff;
DoIO(InputRequestBlock);
return(TRUE);
}
/* FlushHandler() :
*
* Closes the console.device and removes the
* input.device handler from the chain.
*/
void
FlushHandler()
{
if(ConsoleDevice)
CloseDevice(&ConStdReq);
if(InputRequestBlock -> io_Device)
{
InputRequestBlock -> io_Command = IND_REMHANDLER;
InputRequestBlock -> io_Data = (APTR)&HandlerStuff;
DoIO(InputRequestBlock);
CloseDevice(InputRequestBlock);
}
if(InputRequestBlock)
DeleteStdIO(InputRequestBlock);
if(InputDevPort)
DeletePort(InputDevPort);
}
/* ModifiedCloseWBench():
*
* Tells DClock to close its window before the
* Workbench screen gets closed.
*/
void
ModifiedCloseWBench()
{
if(Window)
{
register struct Task *ThisTask = (struct Task *)FindTask(NULL);
register long CurrentPri;
/* Shut down... */
Signal(DSeg -> Child,SIG_BENCH);
/* Careful - rather rude window close check,
* don't waste too much time in the loop.
*/
CurrentPri = SetTaskPri(ThisTask,-1);
while(Window);
SetTaskPri(ThisTask,CurrentPri);
}
}
/* Define these externally to make the SetFunction() calls
* possible.
*/
extern void NewDisplayBeep();
extern void NewCloseWBench();
/* The library offset pointers (old ones). */
long OldDisplayBeep;
long OldCloseWBench;
/* Embedded assembly fragment, handles our replacement call
* for DisplayBeep().
*/
#asm
_NewDisplayBeep:MOVEM.L D2/D3/A4/A6,-(SP) ; Save some registers
MOVE.L A0,-(SP) ; Push NewWindow onto stack
JSR _geta4# ; Tickle the base register
JSR _ModifiedDisplayBeep ; Call our magic creation
ADD.W #4,SP ; Clean the stack up
CLR.L D0 ; Just in case...
MOVEM.L (SP)+,D2/D3/A4/A6 ; Restore some registers
RTS ; Bye...
_NewCloseWBench:MOVEM.L D2/D3/A4/A6,-(SP) ; Rewritten CloseWBench()
; function.
JSR _geta4#
JSR _ModifiedCloseWBench
MOVE.L _OldCloseWBench,A1
MOVEM.L (SP)+,D2/D3/A4/A6
JMP (A1)
#endasm
/* AudioBeep():
*
* Funny beep routine, originally developed by
* John Hodgson as a NewZAP support routine.
* Carefully rewritten to be reentrant beyond
* any measure (Yechh!).
*/
void
AudioBeep()
{
register struct IOAudio *AudioBlock;
register struct MsgPort *ReplyPort;
register UBYTE *WaveMap;
/* No beeping? */
if(!DSeg -> Beep)
return;
/* Eight bytes for channel allocation and
* square wave? Not bad, what do you think?
*/
if(WaveMap = (UBYTE *)AllocMem(8,MEMF_CHIP))
{
/* Cheapo square wave. */
WaveMap[0] = ~127;
WaveMap[1] = ~127;
WaveMap[2] = 127;
WaveMap[3] = 127;
/* This will give us any audio channel. */
WaveMap[4] = 1;
WaveMap[5] = 2;
WaveMap[6] = 4;
WaveMap[7] = 8;
/* Allocate some driver memory. */
if(AudioBlock = (struct IOAudio *)AllocMem(sizeof(struct IOAudio),MEMF_PUBLIC | MEMF_CLEAR))
{
/* Time for a replyport? */
if(ReplyPort = (struct MsgPort *)CreatePort(NULL,0))
{
/* Setup initial driver data. */
AudioBlock -> ioa_Data = &WaveMap[4];
AudioBlock -> ioa_Length = 4;
AudioBlock -> ioa_Request . io_Message . mn_ReplyPort = ReplyPort;
AudioBlock -> ioa_Request . io_Message . mn_Node.ln_Pri = 90;
/* Allocate the channels on the fly. */
if(!OpenDevice("audio.device",0,AudioBlock,0))
{
AudioBlock -> ioa_Request . io_Command = CMD_WRITE;
AudioBlock -> ioa_Request . io_Flags = ADIOF_PERVOL;
AudioBlock -> ioa_Period = 447;
AudioBlock -> ioa_Volume = 64 / 2;
AudioBlock -> ioa_Cycles = 150;
AudioBlock -> ioa_Data = &WaveMap[0];
AudioBlock -> ioa_Length = 4;
/* Beeep! */
BeginIO(AudioBlock);
WaitIO(AudioBlock);
/* Tick! */
CloseDevice(AudioBlock);
}
DeletePort(ReplyPort);
}
FreeMem(AudioBlock,sizeof(struct IOAudio));
}
FreeMem(WaveMap,8);
}
}
/* VideoBeep(Screen,Perform):
*
* Handles the visual part of the DisplayBeep,
* flashes a particular screen or restores its
* original colour (well, hope so).
*/
void
VideoBeep(Screen,Perform)
register struct Screen *Screen;
register BOOL Perform;
{
/* Beep this screen? */
if(Perform)
{
/* Is it already beeping? */
if(!(Screen -> Flags & BEEPING))
{
register UBYTE R,G,B;
/* This one's beeping. */
Screen -> Flags |= BEEPING;
/* Don't forget this one. */
Screen -> SaveColor0 = GetRGB4(Screen -> ViewPort . ColorMap,0);
/* Reverse the colour. */
R = ((Screen -> SaveColor0 >> 8) & 0xF) ^ 0xF;
G = ((Screen -> SaveColor0 >> 4) & 0xF) ^ 0xF;
B = ((Screen -> SaveColor0 ) & 0xF) ^ 0xF;
/* Set it. */
SetRGB4(&Screen -> ViewPort,0,R,G,B);
}
}
else
{
/* Is this one beeping? */
if(Screen -> Flags & BEEPING)
{
register UBYTE R,G,B;
/* This one isn't beeping any longer. */
Screen -> Flags &= ~BEEPING;
/* Restore the saved colour. */
R = ((Screen -> SaveColor0 >> 8) & 0xF);
G = ((Screen -> SaveColor0 >> 4) & 0xF);
B = ((Screen -> SaveColor0 ) & 0xF);
SetRGB4(&Screen -> ViewPort,0,R,G,B);
}
}
}
/* ModifiedDisplayBeep(Screen):
*
* Magic replacement for usual DisplayBeep()
* function.
*/
void
ModifiedDisplayBeep(Screen)
register struct Screen *Screen;
{
static BOOL StillBeeping = FALSE;
if(StillBeeping)
return;
StillBeeping = TRUE;
/* Flash a particular screen. */
if(Screen)
{
Forbid();
VideoBeep(Screen,TRUE);
AudioBeep();
VideoBeep(Screen,FALSE);
Permit();
}
else
{
/* Flash all screens. */
register ULONG IntuiLock;
Forbid();
/* Where's the first one? Has anybody
* used the LockIBase() function so
* far (save me)?
*/
IntuiLock = LockIBase(NULL);
Screen = IntuitionBase -> FirstScreen;
UnlockIBase(IntuiLock);
/* Walk through the screens flashing them all. */
do
VideoBeep(Screen,TRUE);
while(Screen = Screen -> NextScreen);
/* Let it resound. */
AudioBeep();
/* Again: where's the first screen? */
IntuiLock = LockIBase(NULL);
Screen = IntuitionBase -> FirstScreen;
UnlockIBase(IntuiLock);
do
VideoBeep(Screen,FALSE);
while(Screen = Screen -> NextScreen);
Permit();
}
StillBeeping = FALSE;
}
/* PrintIt(TimeBuff):
*
* Prints the formatted string into the Workbench title bar.
*/
void
PrintIt(TimeBuff)
UBYTE *TimeBuff;
{
TimeString . IText = TimeBuff;
TimeString . FrontPen = DSeg -> TextColour;
TimeString . BackPen = DSeg -> BackColour;
PrintIText(RPort,&TimeString,0,0);
}
/* Some more embedded assembly language code, originally
* written by Justin V. McCormick. Uses the ROM printf
* routine to generate a formatted string, then calls
* PrintIt to print it somewhere. This fragment once was
* part of Justin's 'Emit' program.
*/
#asm
_LVORawDoFmt EQU $FFFFFDF6
stuffchar: MOVE.B D0,(A3)+ ; Puts a character into the
RTS ; char-buffer.
XDEF _Format ; Make it known
_Format: MOVE.L 4(SP),D1 ; Take over the args
MOVE.L 8(SP),D0
LEA 12(SP),A1
MOVEM.L A0-A3,-(SP) ; Save these
MOVE.L D1,A3 ; Do the formatting
MOVE.L D0,A0
LEA stuffchar(PC),A2
MOVE.L 4,A6
JSR _LVORawDoFmt(A6)
MOVEM.L (SP)+,A0-A3 ; Restore registers
CLR.L D0 ; and return safely.
RTS
#endasm
/* Ring():
*
* This one rings the bell of the alarm clock.
*/
void
Ring()
{
register struct IOAudio *AudioBlock;
register struct MsgPort *ReplyPort;
struct Screen PublicScreen;
struct Window *ClockWindow;
struct IntuiMessage *Massage;
ULONG Class;
USHORT Code;
struct Gadget *ID;
ULONG IntuiLock;
struct View *ViewLord;
short DyOffset,PlusY;
/* No alarm? */
if(!DSeg -> Alarm)
return;
/* Knockin' on heaven's door... */
OpenWorkBench();
/* Center the clock window. */
GetScreenData(&PublicScreen,sizeof(struct Screen),WBENCHSCREEN,NULL);
NewClockWindow . LeftEdge = (PublicScreen . Width - NewClockWindow . Width) / 2;
NewClockWindow . TopEdge = (PublicScreen . Height - NewClockWindow . Height) / 2;
/* Open it and paint the background. */
if(!(ClockWindow = (struct Window *)OpenWindow(&NewClockWindow)))
return;
SetAPen(ClockWindow -> RPort,1);
RectFill(ClockWindow -> RPort,2,1,ClockWindow -> Width - 3,ClockWindow -> Height - 2);
RefreshGadgets(&ClockGadget[0],ClockWindow,NULL);
/* Adjust the contents of the alarm time string. */
Format(ClockTxt[3] . IText,"Alarm time » %2ld:%02ld:%02ld «",DSeg -> AlarmHour,DSeg -> AlarmMinute,DSeg -> AlarmSecond);
PrintIText(ClockWindow -> RPort,&ClockTxt[0],0,0);
/* Allocate some driver memory. */
if(AudioBlock = (struct IOAudio *)AllocMem(sizeof(struct IOAudio),MEMF_PUBLIC | MEMF_CLEAR))
{
/* Time for a replyport? */
if(ReplyPort = (struct MsgPort *)CreatePort(NULL,0))
{
/* Setup initial driver data. */
AudioBlock -> ioa_Data = &AnyChannel[0];
AudioBlock -> ioa_Length = 4;
AudioBlock -> ioa_Request . io_Message . mn_ReplyPort = ReplyPort;
AudioBlock -> ioa_Request . io_Message . mn_Node.ln_Pri = 90;
/* Allocate the channels on the fly. */
if(!OpenDevice("audio.device",0,AudioBlock,0))
{
AudioBlock -> ioa_Request . io_Command = CMD_WRITE;
AudioBlock -> ioa_Request . io_Flags = ADIOF_PERVOL;
AudioBlock -> ioa_Period = 308;
AudioBlock -> ioa_Volume = 64;
AudioBlock -> ioa_Cycles = 8;
AudioBlock -> ioa_Data = (UBYTE *)&RingData[0];
AudioBlock -> ioa_Length = 7326;
IntuiLock = LockIBase(NULL);
ViewLord = &IntuitionBase -> ViewLord;
UnlockIBase(IntuiLock);
DyOffset = ViewLord -> DyOffset;
/* Ring! */
BeginIO(AudioBlock);
WBenchToFront();
/* Ring until somebody clicked our window. */
FOREVER
{
/* Cycles already finished. */
if(CheckIO(AudioBlock))
BeginIO(AudioBlock);
Class = Code = NULL;
if(Massage = (struct IntuiMessage *)GetMsg(ClockWindow -> UserPort))
{
Class = Massage -> Class;
Code = Massage -> Code;
ID = (struct Gadget *)Massage -> IAddress;
ReplyMsg(Massage);
if(Class == GADGETUP && !ID -> GadgetID)
break;
}
PlusY = 1 - RangeRand(3);
/* Make the view vibrate. */
if(DyOffset + PlusY >= 0)
ViewLord -> DyOffset = DyOffset + PlusY;
RethinkDisplay();
/* Wait a tick. */
Delay(1);
}
ViewLord -> DyOffset = DyOffset;
RethinkDisplay();
/* Still ringing? */
if(!CheckIO(AudioBlock))
AbortIO(AudioBlock);
/* Tick! */
CloseDevice(AudioBlock);
}
DeletePort(ReplyPort);
}
FreeMem(AudioBlock,sizeof(struct IOAudio));
}
CloseWindow(ClockWindow);
}
/* ShowTime(ReallyDoIt):
*
* Yes, it's Showtime! This one compiles the date/timestring
* and prints it.
*/
void
ShowTime(ReallyDoIt)
BOOL ReallyDoIt;
{
UBYTE TempBuff[30];
static char *Months[12] =
{
"Jan","Feb","Mar",
"Apr","May","Jun",
"Jul","Aug","Sep",
"Oct","Nov","Dec"
};
static char *Days[7] =
{
"Sun", /* Note: these have to appear right in this order. */
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
};
static char *LongDays[7] =
{
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
};
static char DateBuff[15],TimeBuff[10],Printed = FALSE;
struct DateStamp Date;
long n,Month,Day,Year;
DateStamp(&Date);
/* Credits go to Tom Rokicki for his DateStamp
* conversion routine.
*/
n = Date . ds_Days - 2251;
Year = (4 * n + 3) / 1461;
n -= 1461 * Year / 4;
Year += 1984;
Month = (5 * n + 2) / 153;
Day = n - (153 * Month + 2) / 5 + 1;
Month += 3;
if(Month > 12)
{
Year++;
Month -= 12;
}
/* Took some time to develop the weekday conversion.
* Please don't ask me how it works, I really don't know.
* The formula was translated from BASIC, which was
* quite a tricky thing to do: I haven't done anything
* in BASIC for at least 2 years.
*/
if(ReallyDoIt)
{
Format(TempBuff,"%s %02ld-%s-%02ld %02ld:%02ld:%02ld",
Days[(Day + Year + (Year - (Month < 3)) / 4 + 3 * Month - 2 * (Month > 2) - (Month - 1 - (Month > 8)) / 2 + 2) % 7],
Day,
Months[Month - 1],
Year - 1900,
Date . ds_Minute / 60,
Date . ds_Minute % 60,
Date . ds_Tick / TICKS_PER_SECOND);
PrintIt(TempBuff);
}
if((!(Date . ds_Tick / TICKS_PER_SECOND) || !Printed) && DSeg -> SetEnv)
{
Printed = TRUE;
Format(DateBuff,"%02ld-%s-%02ld",Day,Months[Month - 1],Year - 1900);
Format(TimeBuff,"%02ld:%02ld",Date . ds_Minute / 60,Date . ds_Minute % 60);
setenv("DAY",LongDays[(Day + Year + (Year - (Month < 3)) / 4 + 3 * Month - 2 * (Month > 2) - (Month - 1 - (Month > 8)) / 2 + 2) % 7]);
setenv("DATE",DateBuff);
setenv("TIME",TimeBuff);
}
}
/* MaxMemSize(MemType):
*
* Returns the length of memory block of a special
* kind. Borrowed from Louis A. Mamakos' GfxMem 0.4.
*/
ULONG
MaxMemSize(MemType)
ULONG MemType;
{
ULONG BlockSize = 0;
struct MemHeader *MemHeader;
extern struct ExecBase *SysBase;
Forbid();
/* Walk through the memory lists adding the
* amount of memory bound to them.
*/
for(MemHeader = (struct MemHeader *)SysBase -> MemList . lh_Head ; MemHeader -> mh_Node . ln_Succ ; MemHeader = (struct MemHeader *)MemHeader -> mh_Node . ln_Succ)
if(MemHeader -> mh_Attributes & MemType)
BlockSize += ((ULONG)MemHeader -> mh_Upper - (ULONG)MemHeader -> mh_Lower);
Permit();
return(BlockSize);
}
/* FindTheBench():
*
* Tries to locate the Workbench screen in the linked list
* of system screens. This is rather a rude method and should
* be exercised only while task-switching is forbidden.
*/
struct Screen *
FindTheBench()
{
register struct Screen *WBench;
register ULONG IntuiLock;
/* Start with the first one. */
IntuiLock = LockIBase(NULL);
WBench = IntuitionBase -> FirstScreen;
UnlockIBase(IntuiLock);
/* Scan the list... */
do
{
/* The type we want? */
if((WBench -> Flags & SCREENTYPE) == WBENCHSCREEN)
return(WBench);
}
while(WBench = WBench -> NextScreen);
/* Failed! */
return(NULL);
}
/* PickClip():
*
* Transfers the contents of the DClock window to
* the Workbench screen bar layer.
*/
void
PickClip()
{
/* This is going to be a very long line. */
ClipBlit(RPort,0,0,
Window -> WScreen -> BarLayer -> rp,LeftEdge,1,
Width,Height,0xC0);
}
/* ShutDown():
*
* Closes DClock and waits for removal.
*/
void
ShutDown()
{
register long j;
/* Restore system functions. */
Forbid();
SetFunction(IntuitionBase,-0x60,OldDisplayBeep);
SetFunction(IntuitionBase,-0x4E,OldCloseWBench);
Permit();
FlushHandler();
FlushSound();
if(Window)
{
SetRast(RPort,1);
PickClip();
CloseWindow(Window);
}
for(j = 0 ; j < 2 ; j++)
if(DummyMap . Planes[j])
FreeMem(DummyMap . Planes[j],Byte(Width) * 8);
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
/* Return the special WBench signal. */
FreeSignal(BenchSig);
/* Sneak out before someone can
* UnLoadSeg() us.
*/
Forbid();
/* Goodbye father. */
if(DSeg -> Father)
Signal(DSeg -> Father,SIGBREAKF_CTRL_D);
/* Tricky, tricky, can we pull ourselves out of the
* swamp? Has anybody tried this yet?
*/
if(!DSeg -> Father)
{
register BPTR Segment = DSeg -> Segment;
RemPort(&DSeg -> Port);
FreeMem(DSeg -> Port . mp_Node . ln_Name,sizeof(PORTNAME));
UnLoadSeg(Segment);
Wait(NULL);
}
}
/* _main():
*
* Modified Aztec C startup-routine, no CLI parsing,
* no Workbench parsing, absolutely nothing.
*/
long
_main()
{
register ULONG SignalSet,MemSize,MaxSize;
register short TextMode = 0;
register struct Screen *Workbench;
register long i;
struct DateStamp Date;
register struct Process *ThatsMe = (struct Process *)FindTask(NULL);
/* If somebody called us from CLI... */
if(ThatsMe -> pr_CLI)
return(10);
/* Is the DSeg structure anywhere? */
if(!(DSeg = (struct DSeg *)FindPort(PORTNAME)))
return(10);
/* Check if it's below our current revision
* number (probably doesn't support some
* structure tags).
*/
if(DSeg -> Revision < REVISION)
{
Signal(DSeg -> Father,DSeg -> RingBack);
return(10);
}
/* Open those libraries. */
if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0)))
{
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
if(!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0)))
{
CloseLibrary(IntuitionBase);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
/* Try to find the Workbench screen. */
if(!(Workbench = (struct Screen *)FindTheBench()))
{
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
/* Adjust the Window left offset. */
LeftEdge = Workbench -> Width - 55 - Width;
/* Open the backdrop window. */
if(!(Window = (struct Window *)OpenWindow(&NewWindow)))
{
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
/* Initialize the click sound data. */
if(!InitSound())
{
FlushSound();
CloseWindow(Window);
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
/* Install the handler code. */
if(!InitHandler())
{
FlushHandler();
FlushSound();
CloseWindow(Window);
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
if((BenchSig = AllocSignal(-1)) == -1)
{
FlushHandler();
FlushSound();
CloseWindow(Window);
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
/* This passage initializes an invisible dummy
* RastPort to be used for text/graphics rendering.
*/
InitBitMap(&DummyMap,2,Width,Height);
/* Clear the BitMap pointers. */
for(i = 0 ; i < 8 ; i++)
DummyMap . Planes[i] = NULL;
/* Allocate the memory. */
for(i = 0 ; i < 2 ; i++)
{
if(!(DummyMap . Planes[i] = AllocMem(Byte(Width) * 8,MEMF_CHIP)))
{
register long j;
for(j = 0 ; j < 2 ; j++)
if(DummyMap . Planes[j])
FreeMem(DummyMap . Planes[j],Byte(Width) * 8);
FlushHandler();
FlushSound();
CloseWindow(Window);
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
FreeSignal(BenchSig);
Signal(DSeg -> Father,DSeg -> RingBack);
return(20);
}
}
/* At last: mangle the RastPort. */
InitRastPort(&DummyRPort);
DummyRPort . BitMap = &DummyMap;
RPort = &DummyRPort;
SetRast(RPort,1);
/* Fill the window and bring it to the front. */
ShowTime();
/* Patch system function. */
Forbid();
OldDisplayBeep = SetFunction(IntuitionBase,-0x60,NewDisplayBeep);
OldCloseWBench = SetFunction(IntuitionBase,-0x4E,NewCloseWBench);
Permit();
/* Now we are truly running. */
DSeg -> Child = (struct Task *)FindTask(NULL);
/* How much memory is there around in this
* Amiga?
*/
MaxSize = MaxMemSize(MEMF_CHIP) + MaxMemSize(MEMF_FAST);
/* Tell father to finish. */
Signal(DSeg -> Father,DSeg -> RingBack);
DSeg -> Father = NULL;
/* Go into infinite loop waiting for signals. */
FOREVER
{
SignalSet = Wait(SIG_TIMER | SIG_CLOSE | SIG_CLICK | SIG_TOGGL | SIG_BENCH | SIG_WINDO);
/* Change the display mode? */
if(SignalSet & SIG_TOGGL)
{
TextMode++;
SetRast(RPort,1);
if(TextMode == 3)
TextMode = 0;
}
/* Are we to click? */
if((SignalSet & SIG_CLICK) && DSeg -> Click)
Click();
/* Are we to shut down? */
if(SignalSet & SIG_CLOSE)
{
ShutDown();
return(0);
}
if(SignalSet & SIG_BENCH)
{
/* Close the window... */
if(Window)
{
CloseWindow(Window);
Window = NULL;
Delay(25);
FOREVER
{
/* Wait for wakeup-call... */
if((SetSignal(NULL,NULL) & SIG_CLOSE) == SIG_CLOSE)
{
SetSignal(NULL,SIG_CLOSE);
SignalSet = SIG_CLOSE;
break;
}
if(Workbench = (struct Screen *)FindTheBench())
{
SignalSet = NULL;
break;
}
Delay(25);
}
}
/* Finish? */
if(SignalSet & SIG_CLOSE)
{
ShutDown();
return(0);
}
/* Re-adjust the Window offset. */
LeftEdge = Workbench -> Width - 55 - Width;
/* Open the window. */
if(!(Window = (struct Window *)OpenWindow(&NewWindow)))
{
ShutDown();
return(0);
}
}
/* A window refresh call came in. */
if(SignalSet & SIG_WINDO)
{
register struct IntuiMessage *IMsg;
/* Reply the Message (don't need it). */
if(IMsg = (struct IntuiMessage *)GetMsg(Window -> UserPort))
ReplyMsg(IMsg);
}
/* Just a time check... */
DateStamp(&Date);
/* Ready to ring the bell? */
if((Date . ds_Minute / 60 == DSeg -> AlarmHour) &&
(Date . ds_Minute % 60 == DSeg -> AlarmMinute) &&
(Date . ds_Tick / TICKS_PER_SECOND == DSeg -> AlarmSecond) &&
DSeg -> Alarm)
Ring();
/* Show time and date. */
if(TextMode == 0)
ShowTime(TRUE);
else
ShowTime(FALSE);
/* Show memory display. */
if(TextMode == 1)
{
long BarLength;
/* For single bitplane Workbench
* screen -> use fill pattern.
*/
static USHORT Checkers[8]=
{
0xAAAA,0x5555,
0xAAAA,0x5555,
0xAAAA,0x5555,
0xAAAA,0x5555
};
/* How much memory is still available? */
MemSize = AvailMem(MEMF_CHIP) + AvailMem(MEMF_FAST);
/* How long will the bar be? */
BarLength = (152 * MemSize) / MaxSize;
DrawImage(RPort,&ImageE,0,0);
/* Draw the full part. */
if(Window -> RPort -> BitMap -> Depth < 2)
SetAfPt(RPort,&Checkers[0],1);
SetAPen(RPort,3);
RectFill(RPort,12,0,164 - BarLength,7);
if(Window -> RPort -> BitMap -> Depth < 2)
SetAfPt(RPort,NULL,0);
/* Add the empty part. */
SetAPen(RPort,2);
RectFill(RPort,165 - BarLength,0,163,7);
}
/* Numeric memory display. */
if(TextMode == 2)
{
UBYTE TempBuff[30];
Format(TempBuff,"C: %07ld F: %07ld",AvailMem(MEMF_CHIP),AvailMem(MEMF_FAST));
PrintIt(TempBuff);
}
/* Transfer the image portion. */
PickClip();
}
}